home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000824-20010305 / 000152_news@columbia.edu _Thu Dec 28 16:12:35 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  2KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from watsun.cc.columbia.edu (watsun.cc.columbia.edu [128.59.39.2])
  3.     by monire.cc.columbia.edu (8.9.3/8.9.3) with ESMTP id QAA28284
  4.     for <kermit.misc@cpunix.cc.columbia.edu>; Thu, 28 Dec 2000 16:12:34 -0500 (EST)
  5. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  6.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id QAA05452
  7.     for <kermit.misc@watsun.cc.columbia.edu>; Thu, 28 Dec 2000 16:12:33 -0500 (EST)
  8. Received: (from news@localhost)
  9.     by newsmaster.cc.columbia.edu (8.9.3/8.9.3) id PAA28982
  10.     for kermit.misc@watsun.cc.columbia.edu; Thu, 28 Dec 2000 15:50:28 -0500 (EST)
  11. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  12. From: fdc@columbia.edu (Frank da Cruz)
  13. Subject: Re: A wish for the FTP-client
  14. Date: 28 Dec 2000 20:50:23 GMT
  15. Organization: Columbia University
  16. Message-ID: <92g92f$s9j$1@newsmaster.cc.columbia.edu>
  17. To: kermit.misc@columbia.edu
  18.  
  19. In article <3A4BA47C.53C64EBA@srv.net>, Kevin Handy  <kth@srv.net> wrote:
  20. : Frank da Cruz wrote:
  21. : > ...  How do you convert a
  22. : > struct tm to a time_t in a reliable way? -- i.e. without writing code to
  23. : > count days, months, years, leap years, leap seconds, and all the rest,
  24. : > taking each machine's architecture into account.  I'm sure I must have
  25. : > overlooked something obvious -- feel free to embarrass me.
  26. : Under *nix, I believe the function to use is mktime
  27. :     time_t mktime(struct tm *timeptr)
  28. 1. The first place I looked (SunOS) doesn't have it.  However, must other
  29.    UNIX OS's do have it.  But...
  30.  
  31. 2. Doesn't do what you want.  "In addition to computing the calendar time,
  32.    mktime() normalizes  the supplied tm structure" -- applies timezone
  33.    conversions, etc.  The problem there is, of course, we don't know, and
  34.    have no way to find out, the server's timezone, and even if we knew it,
  35.    what the rules are to convert to our own.  The struct tm is *already* in
  36.    GMT/UTC, and should not be converted to it again.
  37.  
  38. Thus the resulting file date won't be what you want.  I think the object
  39. of copying the server's MDTM is so update can work in both directions.  If
  40. we use mktime(), I think the result will have up to 24 hours of randomness
  41. added or subtracted.  Am I missing something?
  42.  
  43. - Frank